﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using PoemService.Shared;

namespace PoemServiceWebApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class PoemServiceController : ControllerBase
    {
        private readonly IPoemService service;
        public PoemServiceController(IPoemService service)
        {
            this.service=service;
        }

        [HttpGet("GetPoetByName")]
        public async Task<Poet> GetPoetByName(string name)
        {
            return await service.GetPoetByName(name);
        }

        [HttpGet("GetPoemLine")]
        public async Task<PoemLine> GetPoemLine(string line)
        {
            return await service.GetPoemLine(line);
        }


        [HttpGet("GetPoemLineByPoemId")]
        public async Task<List<PoemLine>> GetPoemLines(string poemid)
        {
            return await service.GetPoemLineByPoemId(poemid);
        }

        [HttpGet("IsPoemLineExist")]
        public async Task<bool> IsPoemLineExist(string line)
        {
            return await service.IsPoemLineExist(line);
        }
    }
}
